#include "setClueCardVolumeMessage.h"
#include "jsonUtils.h"

SetClueCardVolumeMessage::SetClueCardVolumeMessage(MtpProtocol* packet) : MtpMessage(packet),volume(0)
{

}

SetClueCardVolumeMessage::SetClueCardVolumeMessage(const int64_t& clueCardId, const int& channel, const int& volume)
	: MtpMessage(new MtpProtocol(L"setClueCardVolume")),param(clueCardId,channel),volume(0)
{

}

void SetClueCardVolumeMessage::decodeBody()
{
	MtpMessage::decodeBody();
	JsonDoc& doc = param.jsonDeserialize(jsonContent);
	JsonUtils::loadInt(doc, L"volume", volume);
}

void SetClueCardVolumeMessage::encodeBody()
{
	JsonDoc& doc = param.jsonSerialize();
	doc.AddMember(L"volume", volume, doc.GetAllocator());
	jsonContent = JsonUtils::jsonStr(doc);
	MtpMessage::encodeBody();
}

const int& SetClueCardVolumeMessage::getVolume() const
{
	return volume;
}

const ClueCardParam& SetClueCardVolumeMessage::getParam() const
{
	return param;
}
